/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.com.domain;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "causas")
@NamedQueries({@NamedQuery(name = "Causas.findAll", query = "SELECT c FROM Causas c"), @NamedQuery(name = "Causas.findByCaCausa", query = "SELECT c FROM Causas c WHERE c.caCausa = :caCausa"), @NamedQuery(name = "Causas.findByCaDescripcion", query = "SELECT c FROM Causas c WHERE c.caDescripcion = :caDescripcion")})
public class Causas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(generator="causaGen", strategy=GenerationType.SEQUENCE)
    @SequenceGenerator(sequenceName="causas_ca_causa_seq", name="causaGen")
    @Basic(optional = false)
    @Column(name = "ca_causa")
    private Integer caCausa;
    @Column(name = "ca_descripcion")
    private String caDescripcion;
    @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "deCausa", fetch = FetchType.LAZY)
    private Set<Denuncias> denunciasSet;

    public Causas() {
    }

    public Causas(Integer caCausa) {
        this.caCausa = caCausa;
    }

    public Integer getCaCausa() {
        return caCausa;
    }

    public void setCaCausa(Integer caCausa) {
        this.caCausa = caCausa;
    }

    public String getCaDescripcion() {
        return caDescripcion;
    }

    public void setCaDescripcion(String caDescripcion) {
        this.caDescripcion = caDescripcion;
    }

    public Set<Denuncias> getDenunciasSet() {
        return denunciasSet;
    }

    public void setDenunciasSet(Set<Denuncias> denunciasSet) {
        this.denunciasSet = denunciasSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (caCausa != null ? caCausa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Causas)) {
            return false;
        }
        Causas other = (Causas) object;
        if ((this.caCausa == null && other.caCausa != null) || (this.caCausa != null && !this.caCausa.equals(other.caCausa))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.domain.Causas[caCausa=" + caCausa + "]";
    }

}
